package com.cbg.sys.controller;

import com.cbg.base.utils.CodeMsg;
import com.cbg.base.utils.Result;
import com.cbg.sys.entity.*;
import com.cbg.sys.mapper.CarTypeMapper;
import com.cbg.sys.service.ICarTypeService;
import com.cbg.sys.service.ILineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cbg.base.core.SuperController;
import java.util.Objects;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenbing
 * @since 2018-12-16
 */
@RestController
@RequestMapping("/sys/type")
@Api(value = "车型控制器",tags = "车型操作接口")
public class CarTypeController extends SuperController<ICarTypeService, CarType> {
    @Autowired
    CarTypeMapper typeMapper;
    @Autowired
    ILineService lineService;

    @ApiOperation(value="请求可选车型", notes="请求可选车型")
    @ApiImplicitParam(name = "lineId", value = "班次id", required = true, dataType = "String", paramType = "query")
    @GetMapping("/show")
    public Result<?> showTypes(String lineId){
        Objects.requireNonNull(lineId, CodeMsg.IllegalLineArg.getMsg());
        return Result.ok(typeMapper.types(lineId));
    }
}
